SurfaceTracker Class

Description

SurfaceTracker implements tracking with environmental surfaces.

SurfaceTracker occupies one buffer of camera. Use setBufferCapacity of camera to set an amount of buffers that is not less than the sum of amount of buffers occupied by all components. Refer to Overview _ .

After creation, you can call start/stop to enable/disable the track process. start and stop are very lightweight calls.

When the component is not needed anymore, call close function to close it. It shall not be used after calling close.

SurfaceTracker inputs InputFrame from inputFrameSink. InputFrameSource shall be connected to inputFrameSink for use. Refer to Overview _ .

isAvailable

Returns true only on Android or iOS when accelerometer and gyroscope are available.

C: bool easyar_SurfaceTracker_isAvailable(void)
C++17: static bool isAvailable()
Traditional C++: static bool isAvailable()
Java: public static boolean isAvailable()
Kotlin: companion object fun isAvailable(): Boolean
Objective-C: + (bool)isAvailable
Swift: public static func isAvailable() -> Bool
C#: public static bool isAvailable()

inputFrameSink

InputFrame input port. InputFrame must have raw image, timestamp, and camera parameters.

C: void easyar_SurfaceTracker_inputFrameSink(easyar_SurfaceTracker * This, easyar_InputFrameSink * * Return)
C++17: std::shared_ptr<InputFrameSink> inputFrameSink()
Traditional C++: void inputFrameSink(InputFrameSink * * Return)
Java: public @Nonnull InputFrameSink inputFrameSink()
Kotlin: fun inputFrameSink(): InputFrameSink
Objective-C: - (easyar_InputFrameSink *)inputFrameSink
Swift: public func inputFrameSink() -> InputFrameSink
C#: public virtual InputFrameSink inputFrameSink()

bufferRequirement

(since 3.1.0)

Camera buffers occupied in this component.

C: int easyar_SurfaceTracker_bufferRequirement(easyar_SurfaceTracker * This)
C++17: int bufferRequirement()
Traditional C++: int bufferRequirement()
Java: public int bufferRequirement()
Kotlin: fun bufferRequirement(): Int
Objective-C: - (int)bufferRequirement
Swift: public func bufferRequirement() -> Int32
C#: public virtual int bufferRequirement()

outputFrameSource

OutputFrame output port.

C: void easyar_SurfaceTracker_outputFrameSource(easyar_SurfaceTracker * This, easyar_OutputFrameSource * * Return)
C++17: std::shared_ptr<OutputFrameSource> outputFrameSource()
Traditional C++: void outputFrameSource(OutputFrameSource * * Return)
Java: public @Nonnull OutputFrameSource outputFrameSource()
Kotlin: fun outputFrameSource(): OutputFrameSource
Objective-C: - (easyar_OutputFrameSource *)outputFrameSource
Swift: public func outputFrameSource() -> OutputFrameSource
C#: public virtual OutputFrameSource outputFrameSource()

create

Creates an instance.

C: void easyar_SurfaceTracker_create(easyar_SurfaceTracker * * Return)
C++17: static std::shared_ptr<SurfaceTracker> create()
Traditional C++: static void create(SurfaceTracker * * Return)
Java: public static @Nonnull SurfaceTracker create()
Kotlin: companion object fun create(): SurfaceTracker
Objective-C: + (easyar_SurfaceTracker *)create
Swift: public static func create() -> SurfaceTracker
C#: public static SurfaceTracker create()

start

Starts the track algorithm.

C: bool easyar_SurfaceTracker_start(easyar_SurfaceTracker * This)
C++17: bool start()
Traditional C++: bool start()
Java: public boolean start()
Kotlin: fun start(): Boolean
Objective-C: - (bool)start
Swift: public func start() -> Bool
C#: public virtual bool start()

stop

Stops the track algorithm. Call start to start the track again.

C: void easyar_SurfaceTracker_stop(easyar_SurfaceTracker * This)
C++17: void stop()
Traditional C++: void stop()
Java: public void stop()
Kotlin: fun stop(): Unit
Objective-C: - (void)stop
Swift: public func stop() -> Void
C#: public virtual void stop()

close

Close. The component shall not be used after calling close.

C: void easyar_SurfaceTracker_close(easyar_SurfaceTracker * This)
C++17: void close()
Traditional C++: void close()
Java: public void close()
Kotlin: fun close(): Unit
Objective-C: - (void)close
Swift: public func close() -> Void
C#: public virtual void close()

alignTargetToCameraImagePoint

Sets the tracking target to a point on camera image. For the camera image coordinate system ([0, 1]^2), x-right, y-down, and origin is at left-top corner. CameraParameters.imageCoordinatesFromScreenCoordinates can be used to convert points from screen coordinate system to camera image coordinate system.

C: void easyar_SurfaceTracker_alignTargetToCameraImagePoint(easyar_SurfaceTracker * This, easyar_Vec2F cameraImagePoint)
C++17: void alignTargetToCameraImagePoint(Vec2F cameraImagePoint)
Traditional C++: void alignTargetToCameraImagePoint(Vec2F cameraImagePoint)
Java: public void alignTargetToCameraImagePoint(@Nonnull Vec2F cameraImagePoint)
Kotlin: fun alignTargetToCameraImagePoint(cameraImagePoint: Vec2F): Unit
Objective-C: - (void)alignTargetToCameraImagePoint:(easyar_Vec2F *)cameraImagePoint
Swift: public func alignTargetToCameraImagePoint(_ cameraImagePoint: Vec2F) -> Void
C#: public virtual void alignTargetToCameraImagePoint(Vec2F cameraImagePoint)